package com.lanxiao.cloud.modules.oauth.application.dto;

import com.lanxiao.cloud.common.core.dto.TreeNodeDto;
import com.lanxiao.cloud.modules.oauth.infrastructure.enums.ButtonEventEnum;
import com.lanxiao.cloud.modules.oauth.infrastructure.enums.PositionEnum;
import com.lanxiao.cloud.modules.oauth.infrastructure.enums.TypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * @author ：qiaoliang
 * @date ：2021-09-29
 */
@ApiModel("用户资源返回模型")
public class RouteDto extends TreeNodeDto<Long> {
  @ApiModelProperty(value = "类型")
  private final TypeEnum type;
  @ApiModelProperty(value = "按钮位置")
  private final PositionEnum position;
  @ApiModelProperty(value = "按钮事件")
  private final String event;
  @ApiModelProperty(value = "事件类型")
  private final ButtonEventEnum eventType;
  @ApiModelProperty(value = "路由地址")
  private final String path;
  @ApiModelProperty(value = "路由路径")
  private final String component;
  @ApiModelProperty(value = "路由名称")
  private final String name;
  @ApiModelProperty(value = "路由描述")
  private final Meta meta;
  @ApiModelProperty(value = "重定向地址")
  private final String redirect;

  public RouteDto(Long id, Long parentId,
      TypeEnum type, PositionEnum position,
      String event, ButtonEventEnum eventType,
      String path, String component, String name,
      Meta meta, String redirect) {
    super(id, parentId);
    this.type = type;
    this.position = position;
    this.event = event;
    this.eventType = eventType;
    this.path = path;
    this.component = component;
    this.name = name;
    this.meta = meta;
    this.redirect = redirect;
  }

  public TypeEnum getType() {
    return type;
  }

  public PositionEnum getPosition() {
    return position;
  }

  public String getPath() {
    return path;
  }

  public String getEvent() {
    return event;
  }

  public ButtonEventEnum getEventType() {
    return eventType;
  }

  public String getComponent() {
    return component;
  }

  public String getName() {
    return name;
  }

  public Meta getMeta() {
    return meta;
  }

  public String getRedirect() {
    return redirect;
  }



  @ApiModel("用户资源描述返回模型")
  public static class Meta {
    @ApiModelProperty(value = "路由标题")
    private final String title;
    @ApiModelProperty(value = "路由图标")
    private final String icon;

    public Meta(String title, String icon) {
      this.icon = icon;
      this.title = title;
    }

    public String getIcon() {
      return icon;
    }

    public String getTitle() {
      return title;
    }

  }

}
